export function checkPasswordStrength(password: string): 'weak' | 'medium' | 'strong' {
  // 正则表达式检查
  const hasLower = /[a-z]/.test(password);
  const hasUpper = /[A-Z]/.test(password);
  const hasNumber = /\d/.test(password);
  const hasSpecial = /[!@#$%^&*(),.?":{}|<>]/.test(password);

  // 计算字符类型数量
  const typeCount = [hasLower, hasUpper, hasNumber, hasSpecial].filter(Boolean).length;

  if (password.length < 8) return 'weak';  // 长度不足8直接判弱
  if (typeCount === 1) return 'weak';
  if (typeCount === 2) return 'medium';
  if (typeCount >= 3) return 'strong';
  return 'weak';
}

export function isCompleteURL(url:string) {
  const regex = /^(https?|ftp):\/\/[^\s/$.?#].[^\s]*$/i;
  return regex.test(url);
}